//
//  MoviesTableViewCell.m
//  电影er
//
//  Created by dllo on 16/6/24.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MoviesTableViewCell.h"

#import "MoviesModol.h"
@interface MoviesTableViewCell ()
@property(nonatomic,retain)UILabel *dilabel;
@property(nonatomic,retain)UIImageView *imageview;
@property(nonatomic,retain)UIImageView *image;

@end
@implementation MoviesTableViewCell
-(void)dealloc{
    [_dilabel release];
    [_imageview release];
    [_image release];
    [super dealloc];
    
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.imageview = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"bg_eventlistcell@2x.png"]];
        [self.contentView addSubview:_imageview];
        [_imageview release];
        
        self.dilabel =[[UILabel alloc]init];
        [self.imageview addSubview:_dilabel];
        [_dilabel release];
        
        self.image  = [[UIImageView alloc]init];
        [self.imageview addSubview:_image];
        [_image release];
        
            }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
     self.imageview.frame = CGRectMake(10, 10, self.contentView.frame.size.width-20, self.contentView.frame.size.height-20);
    self.dilabel.frame = CGRectMake(150, 40, 200, 40);
    self.dilabel.font = [UIFont boldSystemFontOfSize:20];
    
}
-(void)setMmodel:(MoviesModol *)mmodel{
    if(_mmodel != mmodel){
        [_mmodel release];
        _mmodel = [mmodel retain];
        
        
    }
    self.dilabel.text = mmodel.movieName;
    NSURL *url = [NSURL URLWithString:mmodel.pic_url];
    NSData *data = [NSData dataWithContentsOfURL:url];
    
    self.image.frame = CGRectMake(10, 10, self.imageview.frame.size.width/3, self.imageview.frame.size.height-20);
    _image.image = [UIImage imageWithData:data];
    
    
    
    
    
    
    
    
      }

@end
